package com.cyzy.utils;

import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@Component
public class MultipartFileUtil {
    // 将 MultipartFile 保存到临时文件
    public String saveFile(MultipartFile file) throws IOException {
        String filePath = System.getProperty("java.io.tmpdir") + File.separator
                + file.getOriginalFilename();
        file.transferTo(new File(filePath));
        return filePath;
    }
}
